<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>赠送</title>
		<script src="../js/mui.js"></script>
		<link href="../css/mui.css" rel="stylesheet" />
		<script type="text/javascript" charset="utf-8">
			mui.init();
			if (location.pathname != "/h5/html/login.html" && typeof(sessionStorage.token) == "undefined") {
				mui.openWindow({
					url: 'login.html',
				});
			}
		</script>
		<link rel="stylesheet" href="../css/common.css" />
		<link rel="stylesheet" href="../css/reg.css" />
		<script type="text/javascript" src="../js/common.js"></script>
		<style>
			#sub {
				width: 90%;
				margin: 0.5rem auto;
			}
		</style>
	</head>
	<body>
		<div class="mui-content">
			<form class="mui-input-group">
				<div class="mui-input-row">
					<label>受赠人</label>
					<input type="text" class="mui-input-clear" placeholder="请输入您要赠送的会员号" id="acountId">
				</div>
				<div class="mui-input-row">
					<label>金额</label>
					<input type="text" class="mui-input-clear" placeholder="请输入您赠送的商币金额" id="cloudMoney">
				</div>
				<div class="mui-input-row">
					<label>支付密码</label>
					<input type="password" class="mui-input-clear" placeholder="请输入支付密码" id="payPassword">
				</div>
				<div class="mui-input-row">
					<label>备注</label>
					<input type="text" class="mui-input-clear" placeholder="请输入备注">
				</div>
			</form>
			<button id='sub' class="mui-btn mui-btn-block mui-btn-danger">确认</button>
		</div>
	</body>
</html>
<script>
//确认监听
	document.getElementById("sub").addEventListener("tap", function() {
		var acountId = document.getElementById("acountId").value;
		var cloudMoney = document.getElementById("cloudMoney").value;
		var payPassword = document.getElementById("payPassword").value;
		mui.ajax("/api/v1/cloud/sendCloudMoney", {
			data: {
				paramStr: "{'userName':'" + sessionStorage.userName + "','token':'" + sessionStorage.token + "','acountId':'" + acountId + "','cloudMoney':'" + cloudMoney + "','payPassword':'" + payPassword + "'}"
			},
			dataType: 'json',
			type: 'post',
			success: function(data) {

				if (data.code == 200) {

					function jump() {
						mui.openWindow({
							url: '../index.html',
						});

					}
					mui.toast(data.message, jump);

				} else {
					mui.toast(data.message);
				}
			},
			error: function(xhr, type, errorThrown) {
				//异常处理；
				mui.toast("未知错误");
			}
		});

	})
</script>